package com.zhongwang.mms.module.half.dao;

import com.zhongwang.mms.module.half.model.HalfInveAdjModel;
import com.zhongwang.mms.module.overview.model.ProjectStatusModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface HalfInveAdjDao {
    /**
     *查找调整列表
     * @param hAdjustmentApplyDetail
     * @return list
     */
    List<HalfInveAdjModel> selectHalfInveAdj(HalfInveAdjModel hAdjustmentApplyDetail);

    /**
     *插入物料更改的库存调整
     * @param hAdjustmentApplyDetail
     * @return row
     */
     int insertInveAdj(HalfInveAdjModel hAdjustmentApplyDetail);


    /**
     * 打开修改库存模态框,按id查找
     * @param id
     * @return
     */
    HalfInveAdjModel selectHalfInveAdjById(Integer id);

    /**
     * 保存库存调整
     * @param hAdjustmentApplyDetail
     * @return row
     */
    int updateInvAdj(HalfInveAdjModel hAdjustmentApplyDetail);

    /**
     * 审核列表数据
     * @param hAdjustmentApplyDetail
     * @return 列表数据
     */
    List<HalfInveAdjModel> selectHalfInveAdjAppr(HalfInveAdjModel hAdjustmentApplyDetail);

    /**
     * 审核后更新库存调整状态
     * @param hAdjustmentApplyDetail
     * @return
     */
    int updateInvAdjAppr(HalfInveAdjModel hAdjustmentApplyDetail);


    /**
     * 查找盘点调整
      * @param id
     * @return
     */
    HalfInveAdjModel selectHalfInveCountById(Integer id);

    /**
     * 更新审核信息
     * @param halfInveAdjModel
     * @return
     */
    int updateInvCountAppr(HalfInveAdjModel halfInveAdjModel);

    /**
     * 查找库存调整表中是否已存在此条库存的调整
     * @param ityId
     * @return
     */
    List<HalfInveAdjModel> selectHalfInveAdjModelId(Integer ityId);

    /**
     * 删除和提交调整申请更新调整单状态
     * @param hAdjustmentApplyDetail
     */
    void updateInvAdjStatus(HalfInveAdjModel hAdjustmentApplyDetail);

    /**
     * 生成调整单号
     * @param date2
     * @return
     */
    List<HalfInveAdjModel> findAdjByDate(Date date2);

    /**
     * 查找库存调整单是否有两个相同单号
     * @param aadAdjOrderCode
     * @return
     */
    List<HalfInveAdjModel> selectAdjSameOrderByOrder(String aadAdjOrderCode);

    /**
     * 如果存在相同单号调整单，查找另一单号
     * @param aadAdjOrderCode
     * @return
     */
    HalfInveAdjModel selectAdjSameOrderByOrder1(@Param("aadAdjOrderCode") String aadAdjOrderCode, @Param("aadBeAfFlag") Integer aadBeAfFlag);

    List<ProjectStatusModel> findProjectByCode(HalfInveAdjModel param);

    void updateInvAdjApprByAdjOrderCode(HalfInveAdjModel halfInveAdjModel);
}
